/* 
    数组分块
*/

function chunk(arr, size) {
    if (arr.length === 0) {
        return [];
    }
    let result = [];
    let temp = [];
    // 遍历数组
    arr.forEach(item => {
        // 判断temp是否为空
        if (temp.length === 0) {
            result.push(temp)
        }
        temp.push(item);
        if (temp.length === size) {
            temp = [];
        }
    })
    return result;
}